home *** CD-ROM | disk | FTP | other *** search
/ Champak 106 / Vol 106.iso / games / scorched.swf / scripts / frame_116 / DoAction_8.as < prev    next >
Encoding:
Text File  |  2010-04-12  |  6.2 KB  |  221 lines

  1. _root.frameaction = function()
  2. {
  3.    var _loc1_ = this;
  4.    switch(action)
  5.    {
  6.       case "player stops jetpacing":
  7.          jetpac.play();
  8.          if(jetd == 100)
  9.          {
  10.             p1rot = - random(90);
  11.          }
  12.          else
  13.          {
  14.             p1rot = random(90) + 180;
  15.          }
  16.          if(turn == "player1")
  17.          {
  18.             attachMovie("playertype2","player1",10);
  19.             p1x = hitx;
  20.             p1y = hity;
  21.             if(jetd == 100)
  22.             {
  23.                p1rot = - random(90);
  24.             }
  25.             else
  26.             {
  27.                p1rot = random(90) + 180;
  28.             }
  29.          }
  30.          else
  31.          {
  32.             attachMovie("playertype2","player2",11);
  33.             p2x = hitx;
  34.             p2y = hity;
  35.             p2rot = 90;
  36.             if(jetd == 100)
  37.             {
  38.                p2rot = - random(90);
  39.             }
  40.             else
  41.             {
  42.                p2rot = random(90) + 180;
  43.             }
  44.          }
  45.          player2.gunturretindicator._visible = false;
  46.          player1.gunturretindicator._visible = false;
  47.          rotateplayers();
  48.          action = "end turn";
  49.          break;
  50.       case "jetpacing player":
  51.          startplayerjetpac();
  52.          break;
  53.       case "wait for jetpacing player":
  54.          jetpacing();
  55.          break;
  56.       case "announce round":
  57.          gamemessage2 = "Round " + round;
  58.          attachMovie("tellplayeralt","tellplayeralt",21);
  59.          tellplayeralt._y = 300;
  60.          tellplayeralt._x = 400;
  61.          wait = 0;
  62.          action = "wait for round announce message";
  63.          break;
  64.       case "wait for round announce message":
  65.          wait++;
  66.          if(wait > 60)
  67.          {
  68.             tellplayeralt.play();
  69.             a = random(2) + 1;
  70.             if(a == 1)
  71.             {
  72.                turn = "player1";
  73.                action = "tell player ones move";
  74.             }
  75.             else
  76.             {
  77.                turn = "player2";
  78.                action = "tell player twos move";
  79.             }
  80.             rotateplayers();
  81.          }
  82.          break;
  83.       case "test for game over":
  84.          if(player1score >= 2)
  85.          {
  86.             gotoAndStop(122);
  87.             winner = player1name;
  88.             loser = player2name;
  89.          }
  90.          else if(player2score >= 2)
  91.          {
  92.             gotoAndStop(122);
  93.             winner = player2name;
  94.             loser = player1name;
  95.          }
  96.          else
  97.          {
  98.             action = "Start new round";
  99.          }
  100.          break;
  101.       case "Start new round":
  102.          startnewround();
  103.          action = "announce round";
  104.          break;
  105.       case "test for win":
  106.          wait = 0;
  107.          if(player1health <= 0)
  108.          {
  109.             roundwinnername = player2name;
  110.             action = "tell player they have won";
  111.             player2score++;
  112.             round++;
  113.             break;
  114.          }
  115.          if(player2health <= 0)
  116.          {
  117.             roundwinnername = player1name;
  118.             action = "tell player they have won";
  119.             player1score++;
  120.             round++;
  121.             break;
  122.          }
  123.          if(turn == "player1")
  124.          {
  125.             turn = "player2";
  126.             action = "tell player twos move";
  127.          }
  128.          else
  129.          {
  130.             turn = "player1";
  131.             action = "tell player ones move";
  132.          }
  133.          break;
  134.       case "tell player they have won":
  135.          gamemessage = roundwinnername + " wins this round!";
  136.          attachMovie("tellplayerwin","tellplayer",20);
  137.          tellplayer._y = 300;
  138.          tellplayer._x = 400;
  139.          action = "wait for round won message";
  140.          break;
  141.       case "wait for round won message":
  142.          wait++;
  143.          if(wait > 60)
  144.          {
  145.             tellplayer.play();
  146.             turn = "player1";
  147.             action = "test for game over";
  148.          }
  149.          break;
  150.       case "wait for message":
  151.          wait++;
  152.          if(wait > 60)
  153.          {
  154.             tellplayer.play();
  155.             if(turn == "player1")
  156.             {
  157.                action = "player ones move";
  158.             }
  159.             else
  160.             {
  161.                action = "player twos move";
  162.             }
  163.          }
  164.          break;
  165.       case "tell player ones move":
  166.          _loc1_.player1healthind.playeronesmoney.gotoAndstop(1);
  167.          _loc1_.player2healthind.playertwosmoney.gotoAndstop(2);
  168.          attachMovie("weaponselector","weaponselector",16);
  169.          weaponselector._x = 400;
  170.          weaponpress(player1bombtype);
  171.          windchange();
  172.          player1.gunturretindicator._visible = true;
  173.          player2.gunturretindicator._visible = false;
  174.          player1.marker.gotoAndPlay(2);
  175.          player2.marker.gotoAndStop(1);
  176.          wait = 0;
  177.          gamemessage = player1name + "\'s turn";
  178.          attachMovie("tellplayer","tellplayer",20);
  179.          tellplayer._y = 300;
  180.          tellplayer._x = 400;
  181.          action = "wait for message";
  182.          break;
  183.       case "tell player twos move":
  184.          _loc1_.player1healthind.playeronesmoney.gotoAndstop(2);
  185.          _loc1_.player2healthind.playertwosmoney.gotoAndstop(1);
  186.          attachMovie("weaponselector","weaponselector",16);
  187.          weaponselector._x = 400;
  188.          weaponpress(player2bombtype);
  189.          windchange();
  190.          player2.gunturretindicator._visible = true;
  191.          player1.gunturretindicator._visible = false;
  192.          missleselector._y = 7.7;
  193.          player2.marker.gotoAndPlay(2);
  194.          player1.marker.gotoAndStop(1);
  195.          wait = 0;
  196.          gamemessage = player2name + "\'s turn";
  197.          attachMovie("tellplayer","tellplayer",20);
  198.          tellplayer._y = 300;
  199.          tellplayer._x = 400;
  200.          action = "wait for message";
  201.          break;
  202.       case "player ones move":
  203.          keytest();
  204.          break;
  205.       case "player twos move":
  206.          keytest();
  207.          break;
  208.       case "movebomb":
  209.          movebomb();
  210.          break;
  211.       case "explode bomb":
  212.          explodebomb();
  213.          break;
  214.       case "animate explosion":
  215.          animateExplosion();
  216.          break;
  217.       case "end turn":
  218.          action = "test for win";
  219.    }
  220. };
  221.